home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / STRINGS.SWG / 0057_Stuff SUB in STRING.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  943b  |  21 lines

  1. {*****************************************************************************
  2.  * Function ...... Stuff()
  3.  * Purpose ....... To stuff a string with a sub-string
  4.  * Parameters .... Dest       String to stuff into
  5.  *                 Pos        Position in <Dest> to start inserting
  6.  *                 Num        Number of characters to overwrite in <Dest>
  7.  *                 Source     String to stuff into <Dest>
  8.  * Returns ....... <Dest> stuffed with <Source> at postion <Pos>
  9.  * Notes ......... Uses the function Left.
  10.  * Author ........ Martin Richardson
  11.  * Date .......... May 13, 1992
  12.  *****************************************************************************}
  13. FUNCTION Stuff( Dest : STRING; Pos, Num : INTEGER; Source : STRING ) : STRING;
  14. BEGIN
  15.      IF LENGTH( Source ) > Num THEN Source := Left( Source, Num );
  16.      DELETE( Dest, Pos, Num );
  17.      INSERT( Source, Dest, Pos );
  18.      Stuff := Dest;
  19. END; { Stuff }
  20.  
  21.